import Vue from 'vue'
import Router from 'vue-router'
Vue.use(Router)
/* Layout */
import Layout from '../views/layout/Layout'

/**
 * hidden: true                   if `hidden:true` will not show in the sidebar(default is false)
 * alwaysShow: true               if set true, will always show the root menu, whatever its child routes length
 *                                if not set alwaysShow, only more than one route under the children
 *                                it will becomes nested mode, otherwise not show the root menu
 * redirect: noredirect           if `redirect:noredirect` will no redirct in the breadcrumb
 * name:'router-name'             the name is used by <keep-alive> (must set!!!)
 * meta : {
    title: 'title'               the name show in submenu and breadcrumb (recommend set)
    icon: 'svg-name'             the icon show in the sidebar,
  }
 **/
export const constantRouterMap = [
	{ path: '/login', component: () => import('@/views/login/index'), hidden: true },
	{ path: '/404', component: () => import('@/views/404'), hidden: true },
	{
		path: '',
		component: Layout,
		children: [{
			path: 'ecardAdd',
			component: () => import('@/views/productManage/ecardAdd'),
			name: 'ecardAdd',
			meta: { title: '产品添加', icon: 'ecardAdd', noCache: true }
		}]
	},
	{
		path: '/cooperationPartner',
		component: Layout,
		children: [{
			path: 'index',
			component: () => import('@/views/cooperationPartner/cooperationPartner'),
			name: 'cooperationPartner',
			meta: { title: '合作商家', icon: 'table', noCache: true }
		}]
	},
	{
		path: '',
		component: Layout,
		children: [{
			path: 'ecardEdit',
			component: () => import('@/views/productManage/ecardAdd'),
			name: 'ecardEdit',
			meta: { title: '产品修改 ', icon: 'ecardEdit', noCache: true }
		}]
	},
	{
		path: '/scenicManage',
		component: Layout,
		children: [{
			path: 'scenicAdd',
			name: 'scenicAdd',
			component: () => import('@/views/scenicManage/scenicAdd'),
			meta: { title: '景区添加', icon: 'scenicAdd', noCache: true }
		}]
	},
	{
		path: '/scenicManage',
		component: Layout,
		children: [{
			path: 'scenicEidt',
			name: 'scenicEidt',
			component: () => import('@/views/scenicManage/scenicAdd'),
			meta: { title: '景区修改', icon: 'scenicEidt', noCache: true }
		}]
	},
	{
		path: '/scenicManage',
		component: Layout,
		children: [{
			path: 'scenicDetail',
			name: 'scenicDetail',
			component: () => import('@/views/scenicManage/scenicAdd'),
			meta: { title: '景区详情', icon: 'scenicDetail', noCache: true }
		}]
	},
	{
		path: '/productManage',
		component: Layout,
		children: [{
			path: 'productDetail',
			component: () => import('@/views/productManage/productDetail'),
			name: 'productDetail',
			meta: { title: '产品详情', icon: 'ecardAdd', noCache: false }
		}]
	},
	{
		path: '/productManage',
		component: Layout,
		children: [
			{
				path: 'productList',
				name: 'productList',
				component: () => import('@/views/productManage/productList'),
				meta: { title: '产品列表', icon: 'form' }
			},
			{
				path: 'productLogList',
				name: 'productLogList',
				component: () => import('@/views/productManage/productLogList'),
				meta: { title: '产品日志', icon: 'form' }
			}
		]
	},
	{
		path: '/orderManage',
		component: Layout,
		children: [
			{
				path: 'orderList',
				name: 'orderList',
				component: () => import('@/views/orderManage/orderList'),
				meta: { title: '订单列表', icon: 'form' }
			}
		]
	},
  {
    path: '/orderManage',
    component: Layout,
    children: [
      {
        path: 'orderLogList',
        name: 'orderLogList',
        component: () => import('@/views/orderManage/orderLogList'),
        meta: { title: '订单日志', icon: 'form' }
      }
    ]
  },

	{
		path: '/userManage',
		component: Layout,
		children: [
			{
				path: 'userList',
				name: 'userList',
				component: () => import('@/views/userManage/userList'),
				meta: { title: '账号列表', icon: 'form' }
			}
		]
	},
	{
		path: '/userManage',
		component: Layout,
		children: [
			{
				path: 'memberList',
				name: 'memberList',
				component: () => import('@/views/userManage/memberList'),
				meta: { title: '会员列表', icon: 'form' }
			}
		]
	},
	{
		path: '/scenicManage',
		component: Layout,
		children: [
			{
				path: 'scenicList',
				name: 'scenicList',
				component: () => import('@/views/scenicManage/scenicList'),
				meta: { title: '景区列表', icon: 'form' }
			}
		]
	},
  {
    path: '/scenicManage',
    component: Layout,
    children: [
      {
        path: 'scenicLogList',
        name: 'scenicLogList',
        component: () => import('@/views/scenicManage/scenicLogList'),
        meta: { title: '景区日志', icon: 'form' }
      }
    ]
  },
	{
		path: '/verifyManage',
		component: Layout,
		children: [
			{
				path: 'verifyList',
				name: 'verifyList',
				component: () => import('@/views/verifyManage/verifyList'),
				meta: { title: '验证列表', icon: 'form' }
			}
		]
	},
	{
		path: '/verifyManage',
		component: Layout,
		children: [
			{
				path: 'verifyStatistics',
				name: 'verifyStatistics',
				component: () => import('@/views/verifyManage/verifyStatistics'),
				meta: { title: '验证统计', icon: 'form' }
			}
		]
	},
	{
		path: '/consumeDataManage',
		component: Layout,
		children: [
			{
				path: 'consumeDataRecord',
				name: 'consumeDataRecord',
				component: () => import('@/views/consumeDataManage/consumeDataRecord'),
				meta: { title: '代理商消费记录', icon: 'form' }
			}
		]
	},
	{
		path: '/financeManage',
		component: Layout,
		children: [
			{
				path: 'financeStatistics',
				name: 'financeStatistics',
				component: () => import('@/views/financeManage/financeStatistics'),
				meta: { title: '资金池统计', icon: 'form' }
			}
		]
	},
	{
		path: '/financeManage',
		component: Layout,
		children: [
			{
				path: 'settleAccountReport',
				name: 'settleAccountReport',
				component: () => import('@/views/financeManage/settleAccountReport'),
				meta: { title: '结算报表', icon: 'form' }
			}
		]
	},
	{
		path: '/financeManage',
		component: Layout,
		children: [
			{
				path: 'settleAccountDetail',
				name: 'settleAccountDetail',
				component: () => import('@/views/financeManage/settleAccountDetail'),
				meta: { title: '结算报表详情', icon: 'form' }
			}
		]
	},
	{
		path: '/financeManage',
		component: Layout,
		children: [
			{
				path: 'settleAccountStatistics',
				name: 'settleAccountStatistics',
				component: () => import('@/views/financeManage/settleAccountStatistics'),
				meta: { title: '结算统计', icon: 'form' }
			}
		]
	},
	// 代理商菜单路由begin
	{
		path: '/dProductManage',
		component: Layout,
		children: [
			{
				path: 'dProductList',
				name: 'dProductList',
				component: () => import('@/views/productManage/dProductList'),
				meta: { title: '产品列表', icon: 'form' }
			}
		]
	},
	{
		path: '/dProductManage',
		component: Layout,
		children: [{
			path: 'dProductDetail',
			component: () => import('@/views/productManage/dProductDetail'),
			name: 'dProductDetail',
			meta: { title: '产品详情', icon: 'ecardAdd', noCache: false }
		}]
	},
	{
		path: '/dUserManage',
		component: Layout,
		children: [
			{
				path: 'dUserList',
				name: 'dUserList',
				component: () => import('@/views/userManage/dUserList'),
				meta: { title: '账号列表', icon: 'form' }
			}
		]
	},
	{
		path: '/dOrderManage',
		component: Layout,
		children: [
			{
				path: 'dOrderList',
				name: 'dOrderList',
				component: () => import('@/views/orderManage/dOrderList'),
				meta: { title: '订单列表', icon: 'form' }
			}
		]
	},
	{
		path: '/dOrderManage',
		component: Layout,
		children: [
			{
				path: 'dOrderApply',
				name: 'dOrderApply',
				component: () => import('@/views/orderManage/dOrderApply'),
				meta: { title: '申请退单列表', icon: 'form' }
			}
		]
	},
	{
		path: '/dOrderManage',
		component: Layout,
		children: [
			{
				path: 'dOrderStatistics',
				name: 'dOrderStatistics',
				component: () => import('@/views/orderManage/dOrderStatistics'),
				meta: { title: '订单统计', icon: 'form' }
			}
		]
	},
  {
    path: '/dDataManage',
    component: Layout,
    children: [
      {
        path: 'dDataList',
        name: 'dDataList',
        component: () => import('@/views/consumeDataManage/dConsumeDataRecord'),
        meta: { title: '数据列表', icon: 'form' }
      }
    ]
  },
	// 代理商菜单路由 end
	// 景区菜单路由 start
	{
		path: '/sUserManage',
		component: Layout,
		children: [
			{
				path: 'sUserList',
				name: 'sUserList',
				component: () => import('@/views/userManage/sUserList'),
				meta: { title: '账号列表', icon: 'form' }
			}
		]
	},
	{
		path: '/sMemberManage',
		component: Layout,
		children: [
			{
				path: 'sMemberList',
				name: 'sMemberList',
				component: () => import('@/views/userManage/sMemberList'),
				meta: { title: '会员列表', icon: 'form' }
			}
		]
	},
	// 景区菜单路由 end
	{ path: '*', redirect: '/404', hidden: true },
	{
		path: '/orderManage',
		component: Layout,
		children: [
			{
				path: 'orderApply',
				name: 'orderApply',
				component: () => import('@/views/orderManage/applyRefundList'),
				meta: { title: '申请退单列表', icon: 'form' }
			}
		]
	},
	{
		path: '/sVerifyManage',
		component: Layout,
		children: [
			{
				path: 'sVerifyList',
				name: 'sVerifyList',
				component: () => import('@/views/sVerifyManage/sVerifyList'),
				meta: { title: '验证列表', icon: 'form' }
			}
		]
	},
	{
		path: '/sVerifyManage',
		component: Layout,
		children: [
			{
				path: 'sVerifyStatistics',
				name: 'sVerifyStatistics',
				component: () => import('@/views/sVerifyManage/sVerifyStatistics'),
				meta: { title: '验证统计', icon: 'form' }
			}
		]
	},
	{
		path: '/sBalanceManage',
		component: Layout,
		children: [
			{
				path: 'sBalanceReport',
				name: 'sBalanceReport',
				component: () => import('@/views/sFinanceManage/settleAccountDetail'),
				meta: { title: '结算报表', icon: 'form' }
			}
		]
	},
  {
    path: '/sBalanceManage',
    component: Layout,
    children: [
      {
        path: 'sBalanceStatistics',
        name: 'sBalanceStatistics',
        component: () => import('@/views/sFinanceManage/sBalanceStatistics'),
        meta: { title: '结算统计', icon: 'form' }
      }
    ]
  }
]
// constantRouterMap.beforeEnter((to, from, next) => {
//   document.getElementById('titleId').innerHTML = '要设置的标题'
//   next()
// })


export default new Router({
	scrollBehavior: () => ({ y: 0 }),
	routes: constantRouterMap
})
// router.beforeEach((to, from, next) => {
//   /* 路由发生变化修改页面title */
//   if (to.meta.title) {
//     document.title = to.meta.bigTitle
//   }
//   next()
// })
//
// export default router



